<template>
	<div>
    <el-divider>
      <el-icon>属性配置</el-icon>
    </el-divider>
    <zh-form label-position="top" :model="_value" :span="24">
      <zh-form-switch  prop="required" label="是否必填" v-model="_value.required"> </zh-form-switch>
      <zh-form-switch prop="disabled" label="是否禁用" v-model="_value.disabled"> </zh-form-switch>
      <zh-form-number  prop="width" label="switch 的宽度" v-model="_value.width"></zh-form-number>
      <zh-form-number  prop="height" label="switch 的高度" v-model="_value.height"></zh-form-number>
      <zh-form-input  prop="activeText" label="打开时的描述文字" v-model="_value.activeText"></zh-form-input>
      <zh-form-input  prop="inactiveText" label="关闭时的描述文字" v-model="_value.inactiveText"></zh-form-input>
      <zh-form-input  prop="activeValue" label="switch 状态为 on 时的值" v-model="_value.activeValue"></zh-form-input>
      <zh-form-input  prop="inactiveValue" label="switch的状态为 off 时的值" v-model="_value.inactiveValue"></zh-form-input>      
    </zh-form>
  </div>
</template>
<script lang="ts" setup name="SwitchSetting">
const emits = defineEmits(['update:modelValue']);
//------------------接收传入参数(组件)-------------------
const props = defineProps({
	modelValue: Object,
});
//------------------定义子组件---------------------------

//------------------内部变量定义-------------------------
let _value = ref(Object.assign({fcDragTag:'input'},props.modelValue || {}));
//------------------定义调用方法-------------------------

//------------------初始化------------------------------
onMounted(() => {});
//------------设置给父组件调用的数据/方法(组件)-----------
watch(
	() => props.modelValue,
	(val) => {
		_value.value = Object.assign({fcDragTag:'input'},val || {});
	},
	{
		deep: true,
	}
);
watch(
	() => _value.value,
	(val) => {
		console.log(val);
		emits('update:modelValue', val);
	},
	{
		deep: true,
	}
);

</script>
<style lang="scss" scoped></style>